import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "layout",
      component: () => import("@/layouts/index.vue"),
      redirect: "/home",
      children: [
        {
          path: "/home",
          name: "home",
          component: () => import("@/views/home/index.vue"),
        },
        {
          path: "system",
          name: "system",
          component: () => import("@/views/system/index.vue"),
          redirect: "/system/user",
          children: [
            {
              path: "user",
              name: "user",
              component: () => import("@/views/system/user/index.vue"),
            },
            {
              path: "role",
              name: "role",
              component: () => import("@/views/system/role/index.vue"),
            },
            {
              path: "permission",
              name: "permission",
              component: () => import("@/views/system/permission/index.vue"),
            },
          ],
        },
        {
          path: "campus",
          name: "campus",
          component: () => import("@/views/campus/index.vue"),
          redirect: "/campus/class",
          children: [
            {
              path: "class",
              name: "class",
              component: () => import("@/views/campus/class/index.vue"),
            },
            {
              path: "student",
              name: "student",
              component: () => import("@/views/campus/student/index.vue"),
            },
          ],
        },
      ],
    },
  ],
});

export default router;
